#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1110;
int arr[N];
int n;
void fun()
{
	int j = 1;
	for (int i = 1; i < n; i++) {
		if (arr[i] != arr[i - 1]) {
			arr[j++] = arr[i];
		}
	}
}
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	int j = 0;
	int count = 0;
	for (int i = 0; i < n; i++) {
		if (arr[i] != arr[i + 1]) {
			arr[j++] = arr[i];
		}
	}
	if (arr[n - 1] != arr[n - 2]) {
		arr[j] = arr[n - 1];
	}
	cout << j << endl;
	for (int i = 0; i < j; i++) {
		cout << arr[i] << " ";
	}
	return 0;
}